<?php defined('SYSPATH') OR die('No direct access allowed.');

abstract class Base_Controller extends Template_Controller
{
	protected $session;
	protected $userLang;
	public function __construct()
	{
		parent::__construct();
		$userInfo = array();
		$this->template->head = new View('head');
		$this->template->foot = new View('foot');
		$this->session = Session::instance();
		$this->userLang = Kohana::lang('user');
		user::auto_login();
		//include (Kohana::find_file('vendor/urlshorten','main'));
	}

	/**
	 * 弹出信息(成功/错误)
	 *
	 * @param array 	信息内容
	 * @param string	信息类型
	 * @param string	跳转地址
	 */
	protected function _popMsg($info,$type='err',$url='')
	{
		$url = ($url=='')?url::site():$url;
		$this->template->content = new View('msg');
		$this->template->content->bind('info',$info)
			->bind('infotype',$type)
			->bind('url',$url);
		$this->template->render(true);
		exit;
	}

	protected function _ajaxResponse($status,$msg = array())
	{
		echo json_encode(array('status'=>$status,'msg'=>$msg));
		exit;
	}

}
